package com.wangmengtao.upms.util;

import com.wangmengtao.upms.dto.ServerResponse;


/**
 * @ClassName: ServerResponseUtil
 * @Description: DOTO
 * @Author: WangMengtao
 * @Date: 2019/7/24 21:54
 * @version: 1.0
 **/
public class ServerResponseUtil {
    public static ServerResponse success(Object object) {
        ServerResponse serverResponse = new ServerResponse();
        serverResponse.setCode(200);
        serverResponse.setMessage("成功");
        serverResponse.setData(object);
        return serverResponse;
    }

    public static ServerResponse success() {
        return success(null);
    }

    public static ServerResponse error(Integer code, String message) {
        ServerResponse serverResponse = new ServerResponse();
        serverResponse.setCode(code);
        serverResponse.setMessage(message);
        return serverResponse;
    }
}
